<template>
  <div class="mainContent">
    <!-- <div>
      <div class="block">
        <div><img src="http://img3.epanshi.com/14472/upload/top/sy-banner-08.jpg" alt=""></div>
      </div>
    </div> -->
    <div class="title">
      <div @click="industryNewsHandle()">业界新闻</div>
      <div class="active">最新政策</div>
      <div @click="trademarkClassificationHandle()">商标分类</div>
    </div>
    <div class="contentList" v-if="!articleDisplay">
      <div class="contentRight">
        <ul>
          <li @click="findDetail" v-for="item in list" :key="item.id"><span><img src="../assets/imgs/right.png" alt=""></span><span>{{item.title}}</span> <span class="floatRight">{{item.time}}</span></li>
        </ul>
      </div>
    </div>
    <div class="pageSize" v-if="!articleDisplay">
      <el-pagination
        :page-size="20"
        :pager-count="11"
        layout="total, prev, pager, next"
        :total="1100">
      </el-pagination>
    </div>
    <div v-if="articleDisplay" class="contentArticle">
      <div class="content">
        <p class="titleArticle">{{articalObj.articleTitle}}</p>
        <p class="timeArticle">{{articalObj.createTime|filterTime}}</p>
        <div v-html="articleContent"></div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'IntellectualProperty',
  data () {
   return {
      list: [{
        id: 1,
        title: '人民日报|知识产权保护需各国携手同行',
        time: '2018-11-11'
      }, {
        id: 2,
        title: '专利无效申请：侵权诉讼中反守为攻的利器',
        time: '2018-11-11'
      }, {
        id: 3,
        title: '知识产权维权[律师函]注意事项23点',
        time: '2018-11-11'
      }, {
        id: 4,
        title: '系列解读⑥|加快建立侵权惩罚性赔偿制度',
        time: '2018-11-11'
      }, {
        id: 5,
        title: '7月30日至31日专利局暂停专利收费',
        time: '2018-11-11'
      }, {
        id: 6,
        title: '实务|在专利检索中构建现有技术网络',
        time: '2018-11-11'
      }],
      articleDisplay: false,
      articleContent: '',
      articalObj: {}
    }
  },
  methods: {
    industryNewsHandle () {
      this.$router.push('/industryNews')
    },
    trademarkClassificationHandle () {
      this.$router.push('/trademarkClassification')
    },
    findDetail () {
      this.articleDisplay = true
      this.$http({
        method: 'get',
        url: this.api.GET_FIND_ARTICAL,
        params: {
          id: '16e87891301b434ab0d4964208ed6428'
        }
      }).then(res => {
        console.log(res)
        this.articalObj = res.data
      })
      this.articleContent = '<p>业界新闻内容</p><p>测试</p><p>测试</p><p>测试</p>'
    },
    backHandle () {
      this.articleDisplay = false
    }
  },
  filters: {
    filterTime (val) {
      var d = new Date(val)
      var M = (d.getMonth() + 1) < 10 ? '0' + (d.getMonth() + 1) : (d.getMonth() + 1)
      var D = (d.getDate()) < 10 ? '0' + (d.getDate()) : (d.getDate())
      var H = (d.getHours()) < 10 ? '0' + (d.getHours()) : (d.getHours())
      var MI = (d.getMinutes()) < 10 ? '0' + (d.getMinutes()) : (d.getMinutes())
      var S = (d.getSeconds()) < 10 ? '0' + (d.getSeconds()) : (d.getSeconds())
      var date = d.getFullYear() + '-' + M + '-' + D + ' ' + H + ':' + MI + ':' + S
      return date
    }
  }
}
</script>
<style scoped>
.block{
  height: 100%;
  width: 100%;
}
.block img{
  height: 100%;
  width: 100%;
}
.title {
  width: 1100px;
  margin: 30px auto 15px;

  height: 50px;
}
.title div{
  width: 33.3%;
  /* margin-left: 1%; */
  box-sizing: border-box;
  height: 50px;
  line-height: 50px;
  float: left;
  text-align: center;
  background: #eee;
  /* font-weight: bold; */
  font-size: 15px;
  color: #333;
  cursor: pointer;
  cursor: pointer;
}

.title div.active{
  background: #547d55;
  color: white;
}
.contentList {
  width: 1100px;
  box-sizing: border-box;
  margin: 15px auto;
}
.contentList .contentRight ul li {
  height: 42px;
  line-height: 42px;
  border-bottom: 1px dashed #ccc;
  cursor: pointer;
}
.contentList .contentRight ul li span {
  padding: 0px 5px;
}
.contentList .contentRight ul li span.floatRight{
  float: right;
  color: #999;
}
.contentList .contentRight ul li img {
  width: 10px;
  height: 8px;
}
.pageSize {
  width: 100%;
  height: 60px;
  line-height: 60px;
  text-align: center;
}
.contentArticle {
  width: 1100px;
  box-sizing: border-box;
  margin: 15px auto;
}
.content{
  width: 1100px;
  padding: 20px;
  box-sizing: border-box;
  margin: 30px auto;
  border: 1px #D4D8D9 solid;
}
.contentArticle .titleArticle{
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  line-height: 30px;
  margin-top: 10px;
}
.contentArticle .timeArticle{
  text-align: center;
  font-size: 12px;
  color: #999;
  line-height: 15px;
}
</style>
